package com.ruoyi.system.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.RotationPlot;
import com.ruoyi.system.mapper.RotationPlotMapper;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @author: 风离
 * @Date: 2022/06/22/21:40
 * @Description:
 */
@RestController
@RequestMapping("/system/rotationPlot")
@Slf4j
public class RotationPlotController {

    @Resource
    RotationPlotMapper rotationPlotMapper;

    @GetMapping("/list")
    public AjaxResult list()
    {

        List<RotationPlot> list = rotationPlotMapper.selectAll();
        return AjaxResult.success(list);
    }

    @PostMapping("edit")
    public AjaxResult edit(@RequestBody RotationPlot rotationPlot)
    {
        log.info("rotationPlot:"+rotationPlot);
        int update = rotationPlotMapper.update(rotationPlot);
        log.info("更新数量："+update);
        return AjaxResult.success("更新成功");
    }

    @PostMapping("/add")
    public AjaxResult add(@RequestBody RotationPlot rotationPlot)
    {
        log.info("rotationPlot:"+rotationPlot);
        int add = rotationPlotMapper.add(rotationPlot);
        log.info("插入数量："+add);

        return AjaxResult.success(add);
    }
    @PostMapping("/del")
    public AjaxResult del(@RequestParam("ids")Integer[] ids )
    {
        int del = rotationPlotMapper.del(ids);
        log.info("删除数量："+del);

        return AjaxResult.success(del);
    }
}
